﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

using DrugsShopManagement.DBCLASS;

namespace DrugsShopManagement
{
    public partial class XtraFrmUsers : DevExpress.XtraEditors.XtraForm
    {
        public XtraFrmUsers()
        {
            InitializeComponent();
        }

        Operator op = new Operator();

        private void XtraFrmUsers_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“dataSetUsers.users”中。您可以根据需要移动或删除它。
            this.usersTableAdapter.Fill(this.dataSetUsers.users);
            GetFormWidthHeight();
        }

        private void gridControl1_Click(object sender, EventArgs e)
        {
            this.txtBoxUserName.Text = this.gridView1.GetFocusedRowCellValue("user_name").ToString();
            this.txtBoxID.Text = this.gridView1.GetFocusedRowCellValue("user_id").ToString();
            this.txtBoxUserNo.Text = this.gridView1.GetFocusedRowCellValue("user_no").ToString();
            this.txtBoxSort.Text = this.gridView1.GetFocusedRowCellValue("user_sort").ToString();
            this.comboBox1.Text = this.gridView1.GetFocusedRowCellValue("user_descripe").ToString();
            //this.Text = this.gridView1.GetFocusedRowCellValue("user_").ToString();
        }

        private void XtraFrmUsers_Resize(object sender, EventArgs e)
        {
            GetFormWidthHeight();
        }

        private void GetFormWidthHeight() 
        {
            this.label8.Text = "窗宽：" + this.label8.FindForm().Width.ToString() + "\r\r" + "窗高：" + this.label8.FindForm().Height.ToString();
            this.label8.Text += "\r"+this.label8.Left.ToString();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            this.txtBoxID.Text = string.Empty;
            this.txtBoxRem.Text = string.Empty;
            this.txtBoxUserName.Text = string.Empty;
            this.txtBoxUserNo.Text = string.Empty;
            this.txtBoxUserPwd.Text = string.Empty;
            this.txtBoxSort.Text = string.Empty;
            this.comboBox1.Text = string.Empty;
            this.txtBoxRem.ReadOnly = false;
            this.txtBoxUserName.ReadOnly = false;
            this.txtBoxUserNo.ReadOnly = false;
            this.txtBoxUserPwd.ReadOnly = false;
            this.txtBoxSort.ReadOnly = false;
            //this.comboBox1.ReadOnly = false;
            this.txtBoxUserNo.Focus();
        }

        private void XtraFrmUsers_KeyDown(object sender, KeyEventArgs e)
        {
            if (1==1)
            {
                
            }
        }
    }
}